﻿using CGT.GOP.Common;
using CGT.Infrastructure.Entity;
using CGT.Infrastructure.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CGT.GOP.Controllers
{
    public class SystemSettingController : BaseController
    {
        GovSystemSettingService service = new GovSystemSettingService();

        // GET: SystemSetting
        public ActionResult Index()
        {
            GovSystemSetting model = new GovSystemSetting();
            var list = service.QueryAll();
            if (list.Count > 0)
            {
                model = list[0];
            }
            return View(model);
        }

        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public ContentResult Save(GovSystemSetting model)
        {
            ResultData<long> rData = new ResultData<long>();
            if (model.SettingID > 0)
            {
                service.Update(model);
            }
            else
            {
                service.Insert(model);
            }
            return ReturnResult(rData);
        }
    }
}